package com.example.service.admin;

import com.example.entity.DTO.StudentCourseDetailDTO;
import com.example.entity.StudentCourse;
import com.example.mapper.StudentCourseMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminStudentCourseService {
    @Resource
    private StudentCourseMapper studentCourseMapper;

    public List<StudentCourseDetailDTO> selectAllStudentCourse(String courseName, String studentName, String className) {
        return studentCourseMapper.selectAllStudentCourseByNameAndStudentNameAndClassName(courseName, studentName, className);
    }

    public void addStudentCourse(StudentCourse studentCourse) {
        studentCourseMapper.insert(studentCourse);
    }

    public StudentCourse selectStudentCourse(Integer id) {
        return studentCourseMapper.selectById(id);
    }

    public void updateStudentCourse(StudentCourse studentCourse) {
        studentCourseMapper.updateById(studentCourse);
    }

    public void deleteStudentCourse(Integer id) {
        studentCourseMapper.deleteById(id);
    }
}
